import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom'
const Routerview = (props) => {
  const { routes } = props
  return (
    <Switch>
      {
        routes.length > 0 && routes.map((v, i) => {
          return (
            v.path
              ? <Route key={i} path={v.path} render={porps => <v.component {...porps} routes={v.children}></v.component>}></Route>
              : <Redirect from={v.from} to={v.to} key={i}></Redirect>
          )
        })
      }
    </Switch>
  );
}

export default Routerview;
